// 点击获取验证码按钮后屏蔽60秒 防刷新
/*防刷新：检测是否存在cookie*/
function a(key){
    if($.cookie(key)){
        var count = $.cookie(key);
        var btn = $('#getCode');
        btn.text(count+'秒后重获').addClass('layui-btn-disabled').attr('disabled',true);
        var resend = setInterval(function(){
            count--;
            if (count > 0){
                btn.text(count+'秒后重获').addClass('layui-btn-disabled').attr('disabled',true);
                $.cookie(key, count, {path: '/', expires: (1/86400)*count});
            }else {
                clearInterval(resend);
                btn.text("重新获取").removeClass('layui-btn-disabled').removeAttr('disabled style');
            }
        }, 1000);
    }
}

function b(key){
    var btn = $('#getCode');
    var count = 60;
    var resend = setInterval(function(){
        count--;
        if (count > 0){
            btn.text(count+"秒后重获");
            $.cookie(key, count, {path: '/', expires: (1/86400)*count});
        }else {
            clearInterval(resend);
            btn.text("重新获取").removeClass('layui-btn-disabled').removeAttr('disabled style');
        }
    }, 1000);
    btn.addClass('layui-btn-disabled').attr('disabled',true);
}